import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        orderStatus:["未付款","已付款","待发货","已发货","运输中","已送达","已签收","售后中"],
        labelMarks: ['活动商品', '本周热卖', '精品推荐', '潮流搭配', '首页轮播图'],
        goodsSalesStatus: ['上架', '下架'],
        brands: ['唐朝上野','秦朝春风','商州来源','清明古庄'],
        firstCategory: [],
        secondCategory: [],
        name: '后台数据',
        /*后台数据路径*/
        beginUrl: 'http://localhost:90',
        /*修改文件*/
        modifyData: {},
        /*控制后台显示*/
        backHome: false,
        /*用户是否登录*/
        isLogin: false,
        user:null,

        shopdetail: null,
        backHomeHeader:'/BackHome/',
        options: [
            {
                value: '四川省',
                label: '四川省',
                children: [{
                    value: '成都市',
                    label: '成都市',
                }, {
                    value: '绵阳市',
                    label: '绵阳市',
                }, {
                    value: '自贡市',
                    label: '自贡市',
                }, {
                    value: '攀枝花市',
                    label: '攀枝花市',
                }, {
                    value: '泸州市',
                    label: '泸州市',
                }, {
                    value: '德阳市',
                    label: '德阳市',
                }, {
                    value: '广元市',
                    label: '广元市',
                }, {
                    value: '遂宁市',
                    label: '遂宁市',
                }, {
                    value: '内江市',
                    label: '内江市',
                }, {
                    value: '乐山市',
                    label: '乐山市',
                }, {
                    value: '资阳市',
                    label: '资阳市',
                }, {
                    value: '宜宾市',
                    label: '宜宾市',
                }, {
                    value: '南充市',
                    label: '南充市',
                }, {
                    value: '达州市',
                    label: '达州市',
                }, {
                    value: '雅安市',
                    label: '雅安市',
                }, {
                    value: '阿坝藏族羌族自治州',
                    label: '阿坝藏族羌族自治州',
                }, {
                    value: '甘孜藏族自治州',
                    label: '甘孜藏族自治州',
                }, {
                    value: '凉山彝族自治州',
                    label: '凉山彝族自治州',
                }, {
                    value: '广安市',
                    label: '广安市',
                }, {
                    value: '巴中市',
                    label: '巴中市',
                }, {
                    value: '眉山市',
                    label: '眉山市',
                },]
            },],
        /*确认订单*/
        confirmbill: null,
        activeGoodsList:null,
        newOrderInfo:null,
        userOwnerOrder:null,
    },
  mutations: {
    getModifyData(state,data){
      state.modifyData = data;
      console.log(data)
    },
    controlBackHome(state,data){
      state.backHome=data;
      console.log(data);
    },
      sendUserInfos(state, data){
          state.user = data;
          console.log(data);
      },
    controlUserLogin(state,data){
      state.isLogin=data;
        console.log(data);
    },
    updateshopdetail(state,data){
      if(state.shopdetail==null||state.shopdetail.goodsid!=data.goodsid){
          state.shopdetail=data;
          window.sessionStorage.setItem('shopdetail',JSON.stringify(state.shopdetail))
      }
    },
    setFirstCategory(state,data){
      state.firstCategory = data;
      console.log(data);
    },
    setSecondCategory(state,data){
      state.secondCategory = data;
      console.log(data);
    },
    updatabill(state, data){
          state.confirmbill=data;
          console.log(data);
          window.sessionStorage.setItem('confirmbill', JSON.stringify(state.confirmbill))
    },
    changDialogVisible(state, data) {
          state.dialogVisible = data;
          console.log(data)
    },
      getActiveGoodsList(state, data){
        state.activeGoodsList = data;
        console.log(data);
      },
      saveOrderInfo(state, data){
          state.newOrderInfo = data;
          console.log(data);
      },
      saveUserOwnerOrder(state, data){
          state.userOwnerOrder = data;
          console.log(data);
      },


  },
  actions: {
  },
  modules: {
  }
})
